package top.yuanao.im.servlet;

import com.alibaba.fastjson.JSONObject;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @user Yuanao
 * @CreateDate 2021/10/21 15:30
 */
@WebServlet("/api/signin")
public class SigninServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        resp.setContentType("application/json;charset=utf-8");

        String id = req.getParameter("id");
        String password = req.getParameter("password");


        JSONObject jsonObject = new JSONObject();

        if (null == id || "".equals(id) || null == password || "".equals(password)) {
            jsonObject.fluentPut("status",30).fluentPut("message","参数错误");
            resp.getWriter().print(jsonObject);
            return;
        }













    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }
}
